home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15507 < prev    next >
Encoding:
Text File  |  1996-08-05  |  966 b   |  38 lines

  1. Path: alpha2.csd.uwm.edu!mardavuy
  2. From: mardavuy@alpha2.csd.uwm.edu (Mario David Uy)
  3. Newsgroups: comp.lang.c
  4. Subject: What is wrong with this loop?
  5. Date: 19 Apr 1996 14:06:34 GMT
  6. Organization: Information & Media Technologies, University of Wisconsin - Milwaukee
  7. Distribution: world
  8. Message-ID: <4l86la$1t9@uwm.edu>
  9. NNTP-Posting-Host: 129.89.169.2
  10.  
  11. #include <stdio.h>
  12. int main(void)
  13. {
  14.    int dia;
  15.  
  16.    char cd;
  17.  
  18.    ...
  19.  
  20.    scanf("%c", &cd);
  21.    while (cd != 'm' || cd ! 'f' || cd != 'o')
  22.     {
  23.     printf("Re-enter m, f, or o.\n");
  24.     scanf(%c", &cd);
  25.     }
  26.    ...
  27. }
  28.  
  29. It works fine, except that it gives me the printf() twice.
  30.  
  31. David
  32. mardavuy@csd.uwm.edu
  33. -- 
  34. -------------------------------------------------------------------------------
  35. ||                                          ||Is it gonna be hide or seek,   ||
  36. ||  Mario David Uy                          ||  is it gonna be win or lose?  ||
  37. ||      mardavuy@csd.uwm.edu                ||Is it gonna be pride that keeps||
  38.